package com.bytz.modules.cms.order.controller;

import com.bytz.common.api.vo.Result;
import com.bytz.modules.cms.order.entity.OrderOfflinePay;
import com.bytz.modules.cms.order.service.IMallOrderOfflinePayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "汇票")
@RequestMapping("/offlinePay")
public class OfflinePayController {

    @Autowired
    private IMallOrderOfflinePayService offlinePayService;

    @ApiOperation("根据订单id获取汇票")
    @RequestMapping(value = "/getById", method = RequestMethod.GET)
    public Result<OrderOfflinePay> getById(@RequestParam String id) {
        return Result.ok(offlinePayService.getById(id));
    }

    @ApiOperation("获取经销商所有可用汇票")
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public Result<List<OrderOfflinePay>> getByLoginUser() {
        return Result.ok(offlinePayService.getByLoginUser());
    }
}
